set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_BUILD_TYPE "Release")


set(CMAKE_FIND_ROOT_PATH /opt/xtensa-esp32-elf2)
set(CMAKE_SYSROOT ${CMAKE_FIND_ROOT_PATH}/xtensa-esp32-elf)
set(CMAKE_ASM_COMPILER ${CMAKE_FIND_ROOT_PATH}/bin/xtensa-esp32-elf-as)
set(CMAKE_C_COMPILER ${CMAKE_FIND_ROOT_PATH}/bin/xtensa-esp32-elf-gcc)
set(CMAKE_AR ${CMAKE_FIND_ROOT_PATH}/bin/xtensa-esp32-elf-ar)
#set(CMAKE_C_FLAGS_INIT "-mlongcalls")
#set(FNO_BUILTIN_FLAGS -fno-builtin-printf)
#set(CMAKE_C_FLAGS_INIT "-MMD -mlong-calls -march=armv7-r -mcpu=cortex-r4 -mlittle-endian -mthumb -mthumb-interwork")
#set(CMAKE_C_FLAGS_INIT "${CMAKE_C_FLAGS_INIT} -mfloat-abi=soft -Wall -ffunction-sections -fdata-sections")
#set(CMAKE_C_FLAGS_INIT "${CMAKE_C_FLAGS_INIT} ${FNO_BUILTIN_FLAGS} -Wstrict-prototypes -std=c99 -g -Os")
#set(CMAKE_ASM_FLAGS_INIT "${CMAKE_C_FLAGS_INIT} -mlong-calls -march=armv7-r -mcpu=cortex-r4 -mlittle-endian -mthumb -mthumb-interwork")
#set(CMAKE_ASM_FLAGS_INIT "${CMAKE_ASM_FLAGS_INIT} -mfloat-abi=soft -Wall -Wstrict-prototypes -Os")
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)


